import type { ComponentInternalInstance } from 'vue'

export interface UniComponentInternalInstance extends ComponentInternalInstance {
  renderer: 'page' | 'component'
  parent: ComponentInternalInstance & UniComponentInternalInstance
  ctx: any
}
export function findPageInstance(ins: UniComponentInternalInstance | null) {
  while (ins && ins?.renderer !== 'page') {
    ins = ins.parent
  }
  return ins?.ctx
}
